package automata;

public class Transition {

	private State origin;
	private char value;  //value = ' ' para transiciones lambda
	private State destiny;

	public Transition(State origin, char initialValue, State destiny) {
		this.origin = origin;
		this.value = initialValue;
		this.destiny = destiny;
	}

	public char getValue() {
		return this.value;
	}

	public void setValue(char newValue) {
		this.value = newValue;
	}

	public boolean isLambda() {
		return (this.value == '&');
	}

	public State getDestiny() {
		return destiny;
	}

	public State getOrigin() {
		return origin;
	}

	public boolean accept(Character symbol) {
		if(this.isLambda())
			return true;
		else
			return (symbol != null) && (value == symbol);
	}
}
